home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / python-support / python-rdflib / rdflib / Variable.py < prev   
Encoding:
Python Source  |  2007-04-04  |  486 b   |  23 lines

  1. from rdflib.Identifier import Identifier
  2. try:
  3.     from hashlib import md5
  4. except ImportError:
  5.     from md5 import md5    
  6.  
  7. class Variable(Identifier):
  8.     """
  9.     """
  10.     __slots__ = ()
  11.     def __new__(cls, value):
  12.         return Identifier.__new__(cls, value)
  13.  
  14.     def n3(self):
  15.         return "?%s" % self
  16.  
  17.     def __reduce__(self):
  18.         return (Variable, (unicode(self),))
  19.  
  20.     def md5_term_hash(self):
  21.         d = md5(str(self))
  22.         d.update("V")
  23.         return d.hexdigest()